package cn.ijero.pictureselector.executor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorManager {
    private static ExecutorManager executorManager;

    private final ExecutorService service;

    private ExecutorManager() {
        service = Executors.newFixedThreadPool(128);
    }

    public static ExecutorManager get() {
        if (executorManager == null) {
            synchronized (ExecutorManager.class) {
                if (executorManager == null) {
                    executorManager = new ExecutorManager();
                }
            }
        }
        return executorManager;
    }

    public void post(Runnable runnable){
        service.execute(runnable);
    }

}
